import request from '@/utils/request'

import { objectToFormData } from '@/utils/form'

export function findSceneMenuList(data) {
  return request({
    url: '/51world/scene/menu/findList',
    method: 'get',
    params:data
  })
}

export function getSceneMenuOptionsTree() {
  return request({
    url: '/51world/scene/menu/getOptionsTree',
    method: 'get',
  })
}

export function saveSceneMenu(data) {
  return request({
    url: '/51world/scene/menu/save',
    method: 'post',
    data: objectToFormData(data)
  })
}

export function deleteSceneMenu(data) {
  return request({
    url: '/51world/scene/menu/delete',
    method: 'get',
    params:data
  })
}

export function genMenuRoot(data) {
  return request({
    url: '/51world/scene/menu/genRoot',
    method: 'get',
    params:data
  })
}

export function getOptionsByMenu(params) {
  return request({
    url: '/51world/scene/getOptionsByMenu',
    method: 'get',
    params:params
  })
}


export function copySceneSrc(data) {
  return request({
    url: '/51world/scene/src/copySrc',
    method: 'get',
    params:data
  })
}

export function getSceneMenuTree(data) {
  return request({
    url: '/51world/scene/menu/getTree',
    method: 'get',
    params:data
  })
}

export function getSceneMenuSrcById(data) {
  return request({
    url: '/51world/scene/menu/getMenuSrcById',
    method: 'get',
    params:data
  })
}


/**
 * @param {Object} data
 */
export function saveSceneMenuLayers(data) {
  return request({
    url: '/51world/scene/menu/saveSceneLayers',
    method: 'post',
    data
  })
}


/**
 * 根据菜单ID获取选中图层
 * @param {Object} params
 */
export function getLayerIdsByMenuId(params) {
  return request({
    url: '/51world/scene/menu/getLayerIdsById',
    method: 'get',
    params:params
  })
}

/**
 * 获取图层数数据
 * @param {Object} params
 */
export function getSceneLayerTree(params) {
  return request({
    url: '/51world/scene/layer/getOptionsTree',
    method: 'get',
    params:params
  })
}
